// JavaScript Document
;$(document).ready(function () {

    var regName = /^\S{1,6}$/;
    var regText = /^.{1,30}$/;
    var regbank = /^(\d{4}\s){4}\d{0,5}$/;
    var reg_childpsd = /^\d{6}$/;
    var reg_childcode = /^\d{1,6}$/;
    var reg_childtel = /^1[34578]\d{9}$/;

//index页面
    //左导航二级点击显示效果
    $(".indexpage_leftu2>li>a").click(function () {
        if ($(this).next("ul").is(":hidden")) {
            $(this).addClass("cur").next("ul").stop().show();
        } else {
            $(this).removeClass("cur").next("ul").stop().hide();
        }
    })

    //统计图切换
    $("#indexpage_ratechart").hide();
    $(".indexpage_echartcut").on("click", function () {
        if ($("#indexpage_ratechart").is(":hidden")) {
            $("#indexpage_barchart").stop().hide();
            $("#indexpage_ratechart").stop().show();
            $(this).text("切换查看直方图");
        } else {
            $("#indexpage_ratechart").stop().hide();
            $("#indexpage_barchart").stop().show();
            $(this).text("切换查看占比率");
        }

    });

//account_changlong_one页面   现金列表展示
    //$(".accountpage_changlongone_cashlist").hide();
    $(".accountpage_changlongone_cash a").on("click", function () {
        if ($(".accountpage_changlongone_cashlist").is(":hidden")) {
            $(this).next("div").stop().slideDown();
            $(this).addClass("cur");
        } else {
            $(this).next("div").stop().slideUp();
            $(this).removeClass("cur");
        }

    });

//combo.html页面
    //编辑套餐
    $(".combopage_comboeditbtn").on("click", function () {
        $(this).parent().next("div").css({"transition": "all 0.7s", "left": "80px", "opacity": "1","z-index":"1"});
    });
    /*$(".combopage_comboeditsave").on("click", function () {
        var combo_editvalue = parseInt($(this).prev("input").val());
        if (combo_editvalue > 999) {
            combo_editvalue = 999;
        }
        $(this).prev("input").val(combo_editvalue);
        if (combo_editvalue > 0) {
            $(this).prev("input").css("box-shadow", "none");
            $(this).parent().prev("p").children("span").children("span").text(combo_editvalue);
            $(this).parent().css({"transition": "all 0.3s", "left": "950px", "opacity": "0","z-index":"-1"});
        } else {
            $(this).prev("input").css("box-shadow", "0 0 3px 1px #f00");
        }
    });*/

    /*
     //combo_add.html页面
     //添加套餐
     $(".combo_addbtn").on("click", function(){
     $(this).parent().prev("ul").append("<li><i>"+($(".combo_addlist li").length+1)+"</i><span>套餐单价：</span><input type='number' value='120'><span>套餐币数：</span><input class='combo_add_combonumber' type='number' value='150'><a class='combo_addbutton' href='javascript:;'>确认</a><a class='combo_addcancel' href='javascript:;'>取消</a></li>");
     //添加币数输入框
     $(".combo_add_combonumber").on("keyup", function(){
     var combo_add_numbvalue0=parseInt($(this).val());
     if(combo_add_numbvalue0>999){
     combo_add_numbvalue0=999;
     }
     $(this).val(combo_add_numbvalue0);
     if(combo_add_moneyvalue0<=0){
     $(this).css("box-shadow","0 0 3px 1px #f00");
     }else{
     $(this).css("box-shadow","none");
     }
     });
     //添加确认
     $(".combo_addbutton").on("click", function(){
     var combo_add_moneyvalue=$(this).prev().prev().prev("input").val();
     var combo_add_numbvalue=parseInt($(this).prev("input").val());
     if(combo_add_numbvalue>999){
     combo_add_numbvalue=999;
     }
     $(this).prev("input").val(combo_add_numbvalue);
     if(combo_add_moneyvalue<=0){
     $(this).prev().prev().prev("input").css("box-shadow","0 0 3px 1px #f00");

     }else if(combo_add_moneyvalue>0 && combo_add_numbvalue<=0){
     $(this).prev().prev().prev("input").css("box-shadow","none");
     $(this).prev("input").css("box-shadow","0 0 3px 1px #f00");

     }else if(combo_add_numbvalue>0 && combo_add_moneyvalue>0){
     $(this).prev("input").css("box-shadow","none");
     $(this).prev().prev().prev("input").css("box-shadow","none");
     $(this).parent().remove();
     }
     });
     //添加取消
     $(".combo_addcancel").on("click", function(){
     $(this).parent().remove();
     })
     });



     //combo_manage.html页面
     //批量编辑
     $(".combo_managebtn").hide();
     var combo_managevalue=new Array();
     function batchmanage(){
     $(".combo_manage_batchmanagebtn").on("click", function(){     //批量编辑按钮
     if($(".combo_manage_batchmanagebtn").text()=="批量编辑"){
     $(".combo_edit").css({"transition":"all 0.7s","left":"80px","opacity":"1"});
     $(".combo_managebtn").stop().show().text("保存").css("background","#38adff");
     $(".combo_manage_batchmanagebtn").text("退出批量编辑");
     $(".combo_manage_batchdeletebtn").unbind("click");
     }else{
     $(".combo_edit").css({"transition":"all 0.3s","left":"500px","opacity":"0"});
     $(".combo_managebtn").stop().hide();
     $(".combo_manage_batchmanagebtn").text("批量编辑");
     batchdelete();
     }
     })
     };
     batchmanage();

     //批量删除
     $(".combo_managelist li p input, .combo_managecheckall").hide();
     function batchdelete(){
     $(".combo_manage_batchdeletebtn").on("click", function(){     //批量删除按钮
     if($(".combo_manage_batchdeletebtn").text()=="批量删除"){
     $(".combo_managelist li p input, .combo_managecheckall").stop().show();
     $(".combo_managebtn").stop().show().text("删除").css("background","#f00");
     $(".combo_manage_batchdeletebtn").text("退出批量删除");
     $(".combo_manage_batchmanagebtn").unbind("click");

     }else{
     $(".combo_managelist li p input, .combo_managecheckall").stop().hide();
     $(".combo_managebtn").stop().hide();
     $(".combo_manage_batchdeletebtn").text("批量删除");
     batchmanage();
     }
     });
     };
     batchdelete();

     //全选按钮
     $(".pointpage_dv").hide();
     $(".combo_managecheckall input").on("click", function(){     //批量删除按钮
     if($(".combo_managecheckall input").is(":checked")){
     $(".combo_managelist li p input").each(function(combo_index1){
     $(".combo_managelist li p input").eq(combo_index1)[0].checked=true;
     })
     }else{
     $(".combo_managelist li p input").each(function(combo_index2){
     $(".combo_managelist li p input").eq(combo_index2)[0].checked=false;
     })
     }
     });

     //分项子按钮
     $(".combo_managelist li p input").each(function(){
     $(this).click(function(){
     var combo_index3=0;
     if(!$(this).is(":checked")){
     $(".combo_managecheckall input")[0].checked=false;
     }else if($(this).is(":checked")){
     for(var combo_index4=0; combo_index4<$(".combo_managelist li").length; combo_index4++){
     if($(".combo_managelist li p input").eq(combo_index4).is(":checked")){
     combo_index3++;
     if(combo_index3==$(".combo_managelist li").length){
     $(".combo_managecheckall input")[0].checked=true;
     }
     }
     }
     }
     })
     })

     //保存or删除按钮
     $(".combo_managebtn").on("click", function(){
     if($(".combo_managebtn").text()=="保存"){
     var j=0;
     for(var i=0; i<$(".combo_managelist li").length; i++){
     combo_managevalue[i]=parseInt($(".combo_edit input:eq("+i+")").val());
     if(combo_managevalue[i]>999){
     combo_managevalue[i]=999;
     }
     $(".combo_edit input:eq("+i+")").val(combo_managevalue[i]);
     if(combo_managevalue[i]>0){
     $(".combo_edit input:eq("+i+")").css("box-shadow","none");
     $(".combo_managelist li:eq("+i+") p span span").text(combo_managevalue[i]);
     j++;
     if(j==$(".combo_managelist li").length){
     $(".combo_edit").css({"transition":"all 0.3s","left":"500px","opacity":"0"});
     $(".combo_manage_batchmanagebtn").text("批量编辑");
     batchdelete();
     }
     }else{
     $(".combo_edit input:eq("+i+")").css("box-shadow","0 0 3px 1px #f00");
     }
     }
     }else if($(".combo_managebtn").text()=="删除"){
     var combo_deleteIndex=0;
     for(var combo_index5=0; combo_index5<$(".combo_managelist li").length; combo_index5++){
     if($(".combo_managelist li p input").eq(combo_index5).is(":checked")){
     combo_deleteIndex++;
     }
     }
     $(".pointpage_dv").stop().show();
     $(".pointpage p span").text(combo_deleteIndex);
     //删除确定按钮
     $(".combo_pointpage_btn1").on("click", function(){
     $(".pointpage_dv, .combo_managebtn, .combo_managelist li p input, .combo_managecheckall").stop().hide();
     $(".combo_managelist li p").find(":checked").parents("li").remove();
     $(".combo_manage_batchdeletebtn").text("批量删除");
     batchmanage();
     })
     //删除取消按钮
     $(".combo_pointpage_btn2").on("click", function(){
     $(".pointpage_dv").stop().hide();
     })
     }
     });
     */

//place.html页面   场地设备列表
    $(".place_listdv").hide();
    $(".place_list li>a").on("click", function () {
        if ($(this).next("div").is(":hidden")) {
            $(this).next("div").stop().slideDown();
            $(this).addClass("cur");
        } else {
            $(this).next("div").stop().slideUp();
            $(this).removeClass("cur");
        }
    });
    //场地名称修改
    //编辑
    $(".place_changename").on("click", function () {
        $(this).parent().next("div").css({"transition": "all 0.1s", "left": "0px"});
    });
    //取消
    $(".place_changenamebtn2").on("click", function () {
        $(this).parent("div").css({"transition": "all 0.1s", "left": "950px"});
    });
    //确定
    $(".place_changenamebtn1").on("click", function () {
        var place_changenameval = $(this).prev("input").val();
        if (regName.test(place_changenameval)) {
            changePlaceName();
        }else{
            alert("场地格式不正确");
        }
    });

//inventorylist.html页面   编辑 事件
    //编辑
    $(".inventorylist_edit").on("click", function () {
        $(this).parent().next("div").css({"transition": "all 0.1s", "left": "80px"});
    });
    //取消
    $(".inventorylist_editCurno").on("click", function () {
        $(this).parent().parent("div").css({"transition": "all 0.1s", "left": "950px"});
    });
    //确定
    $(".inventorylist_editCur").on("click", function () {
        // inventorylist_name=$(this).parent().parent("div").find(".inventorylist_equipmentNameCur").children("input").val();
        var inventorylist_number = $(this).parent().parent("div").find(".inventorylist_inventoryCur").children("input").val();
        var inventorylist_imgName = $(this).parent().parent().find(".inventorylist_equipmentImgName").val();

        if (inventorylist_number > 0 && regName.test(inventorylist_imgName)) {
            //$(this).parent().parent().parent("li").find(".inventorylist_equipmentName").children("span").text(inventorylist_name);
            $(this).parent().parent().parent("li").find(".inventorylist_inventory").children("span").text(inventorylist_number);
            $(this).parent().parent().parent("li").find(".inventorylist_equipmentImg").children().next("span").text(inventorylist_imgName);
            $(this).parent().parent("div").css({"transition": "all 0.1s", "left": "950px"});
        }
    });

//equipment.html页面
    //左边导航
    $(".equipment_leftu1>li>a").on("click", function () {
        if ($(this).next("ul").is(":hidden")) {
            $(this).next("ul").slideDown();
            $(this).addClass("cur");
        } else {
            $(this).next("ul").slideUp();
            $(this).removeClass("cur");
        }
    });
    $(".equipment_leftu2>li>a").on("click", function () {
        $(".equipment_leftu2>li>a").removeClass("cur");
        $(this).addClass("cur");
    });


//equipment_state.html页面
    //远程补币
    //减
    var equipment_state_numb = 0;
    $(".equipment_state_replenishdv span:eq(0)").on("click", function () {
        equipment_state_numb = parseInt($(".equipment_state_replenishdv input").val());
        equipment_state_numb--;
        if (equipment_state_numb <= 0) {
            equipment_state_numb = 0;
        }
        $(".equipment_state_replenishdv input").val(equipment_state_numb);
    });
    //加
    $(".equipment_state_replenishdv span:eq(1)").on("click", function () {
        equipment_state_numb = parseInt($(".equipment_state_replenishdv input").val());
        equipment_state_numb++;
        if (equipment_state_numb >= 99) {
            equipment_state_numb = 99;
        }
        $(".equipment_state_replenishdv input").val(equipment_state_numb);
    });
    //输入框输入
    $(".equipment_state_replenishdv input").on("keyup", function () {
        equipment_state_numb = parseInt($(this).val());
        if (equipment_state_numb <= 0) {
            equipment_state_numb = 0;
        }
        if (equipment_state_numb >= 99) {
            equipment_state_numb = 99;
        }
        $(this).val(equipment_state_numb);
        if (equipment_state_numb >= 0) {
            $(this).css("box-shadow", "none");
        } else {
            $(this).css("box-shadow", "0 0 3px 1px #f00");
        }
    });
    //设备状态  补币确认


    //设备状态   二维码
    $(".equipment_state_code").hide();
    $(".equipment_state_codebtn").on("click", function () {
        if ($(".equipment_state_codebtn").text() == "查看") {
            $(".equipment_state_code").stop().slideDown();
            $(".equipment_state_codebtn").text("取消");
        } else {
            $(".equipment_state_code").stop().slideUp();
            $(".equipment_state_codebtn").text("查看");
        }
    });

    //设备状态   套餐设置   参数设置
    $(".equipment_state_combobutton~div, .equipment_state_setCombo").hide();
    $(".equipment_state_combobutton, .equipment_state_setCombobutton").on("click", function () {
        if ($(this).text() == "编辑") {
            $(this).next().stop().slideDown();
            $(this).text("取消");
        } else {
            $(this).next().stop().slideUp();
            $(this).text("编辑");
        }
    });

    //设备状态  参数设置 修改
    $(".equipment_state_setbtn").on("click", function () {
        $(this).next().next("div").css({"transition": "all 0.1s", "right": "30px"});
    });
    //参数设置 取消
    $(".equipment_state_setdvbtn2").on("click", function () {
        $(this).parent("div").css({"transition": "all 0.1s", "right": "-350px"});
    });
    //参数设置 确定

    /*$(".equipment_state_setdvbtn1").on("click", function(){
     var  equipment_state_setParameter=$(this).prev("input").val();
     if(equipment_state_setParameter>0){
     $(this).parent().prev("span").text(equipment_state_setParameter);
     $(this).parent("div").css({"transition":"all 0.1s","right":"-350px"});
     }
     });*/

    //设备名称 修改
    $(".equipment_state_eqNameSetbtn").on("click", function () {
        $(this).next("div").css({"transition": "all 0.1s", "right": "30px"});
    });
    //设备名称 取消
    $(".equipment_state_eqNamesetdvbtn2").on("click", function () {
        $(this).parent("div").css({"transition": "all 0.1s", "right": "-350px"});
    });
    //设备名称 确定
    /*$(".equipment_state_eqNamesetdvbtn1").on("click", function(){
     var equipment_state_seteqName=$(this).prev("input").val();
     if(regName.test(equipment_state_seteqName)){
     $(this).parent().prev().prev("span").text(equipment_state_seteqName);
     $(this).parent("div").css({"transition":"all 0.1s","right":"-350px"});
     }
     });*/


    //设备状态  套餐设置————选中
    $(".equipment_state_combobtn").on("click", function () {
        if ($(this).hasClass("cur")) {
            $(this).removeClass("cur");
            $(this).next("input").removeAttr("disabled", "disabled");
        } else {
            $(this).addClass("cur");
            $(this).next("input").attr("disabled", "disabled");
        }
    });

    //套餐设置————确认
    /*$(".equipment_state_combobutton2").on("click", function(){
     $(this).parent().parent().slideUp();
     $(this).parent().parent().prev().text("编辑");
     });*/

    //设备状态  禁用、启动
    /*$(".equipment_state_disable").on("click", function(){
     if($(this).hasClass("cur")){
     $(this).removeClass("cur");
     }else{
     $(this).addClass("cur");
     }
     });*/


    //设备状态 设备名称 取消
    $(".equipment_state_placebtn2").on("click", function () {
        $(".pointpage_dv").stop().hide();
    });
    //设备名称 确定
    var equipment_state_placeName = "";
    $(".equipment_state_placebtn1").on("click", function () {
        equipment_state_placeName = $(".equipment_state_place a.cur").prev("span").text();
        $(".equipment_state_placeNamebtn").prev("span").text(equipment_state_placeName);
        $(".pointpage_dv").stop().hide();
    });

    //设备状态  场地归属
    $(".equipment_state_placedv").hide();
    $(".equipment_state_placeNamebtn").on("click", function () {
        if ($(this).text() == "编辑") {
            $(this).next().stop().slideDown();
            $(this).text("取消");
        } else {
            $(this).next().stop().slideUp();
            $(this).text("编辑");
        }
    });
    //设备状态  场地归属查询输入框  场地归属查询按钮
    $(".equipment_state_placequery input, .equipment_state_placequery a").on("keyup click", function () {
        var equipment_state_placequeryval = $(".equipment_state_placequery input").val();
        $(".equipment_state_place li").hide();
        $(".equipment_state_place li").find(":contains(" + equipment_state_placequeryval + ")").parents("li").show();
    });

    //设备状态  场地归属点击
    /*$(".equipment_state_place li").each(function(){
     $(this).click(function(){
     $(".equipment_state_placeName span:eq(1)").text($(this).text());
     $(this).parent().parent("div").slideUp();
     $(".equipment_state_placeNamebtn").text("编辑");
     })
     });*/

    //解绑设备
    $(".equipment_state_unwrap").on("click", function () {
        $(".pointpage_dv3").stop().show();
    });
    //解绑设备  确认
    $(".equipment_state_unwrapbtn1").on("click", function () {
        $(".pointpage_dv3").stop().hide();
        $(".pointpage_dv4").stop().show();
    });
    //解绑设备  取消
    $(".equipment_state_unwrapbtn2").on("click", function () {
        $(".pointpage_dv3").stop().hide();
    });


//promocode.html页面
    $(".page_right .promocode_inner:not(:first)").hide();
    $(".combopage_leftu1 a").each(function (index) {
        $(this).click(function () {
            $(this).addClass("cur").parent("li").siblings().children("a").removeClass("cur");
            $(".page_right .promocode_inner:eq(" + index + ")").stop().show().siblings().stop().hide();
        })
    })

//promocode_add.html页面
    //币数输入框
    $(".promocode_add_number").on("keyup", function () {
        var promocode_add_number = parseInt($(this).val());
        if (promocode_add_number <= 1) {
            promocode_add_number = 1;
        }
        if (promocode_add_number >= 999) {
            promocode_add_number = 999;
        }
        $(this).val(promocode_add_number);
        if (promocode_add_number >= 1 || promocode_add_number == "") {
            $(this).css("box-shadow", "none");
        } else {
            $(this).css("box-shadow", "0 0 3px 1px #f00");
        }
    });

//promocode_add_batch.html页面
    //批量 优惠码数量输入框
    $(".promocode_add_batchnumber").on("keyup", function () {
        var promocode_add_batchnumber = parseInt($(this).val());
        if (promocode_add_batchnumber <= 1) {
            promocode_add_batchnumber = 1;
        }
        if (promocode_add_batchnumber >= 500) {
            promocode_add_batchnumber = 500;
        }
        $(this).val(promocode_add_batchnumber);
        if (promocode_add_batchnumber >= 1 || promocode_add_batchnumber == "") {
            $(this).css("box-shadow", "none");
        } else {
            $(this).css("box-shadow", "0 0 3px 1px #f00");
        }
    });

//my.html页面
    //账号与安全
    $(".my_accountSafe").on("click", function () {
        if ($(this).hasClass("cur")) {
            $(this).removeClass("cur");
            $(".my_leftu2").css("display", "none");
        } else {
            $(this).addClass("cur");
            $(".my_leftu2").css("display", "block");
        }
    });

//my_childAccount.html页面
    //管理 显示隐藏
    $(".my_childAccount_managedv, .my_placemanage_managedv").hide();
    $(".my_childAccount_resetpsd").on("click", function () {
        if ($(this).parent().parent().find(".my_childAccount_managedv").is(":hidden")) {
            $(this).parent().parent().find(".my_childAccount_managedv").stop().show().siblings("div").hide();
            $(this).css("background", "#EEE").siblings().css("background", "#FFF");
        } else {
            $(this).parent().parent().find(".my_childAccount_managedv").stop().hide();
            $(this).css("background", "#FFF");
        }
    });
    //管理 恢复初始密码
    $(".pointpage_dv1, .pointpage_dv4").hide();
    $(".my_childAccount_beginpsd").on("click", function () {
        $(this).next("div").stop().show();
        $(".pointpage_dv1").on("click", function () {
            $(".pointpage_dv1").stop().hide();
        });
    });
    //管理 删除按钮
    $(".pointpage_dv3").hide();
    $(".my_childAccount_deletebutton").on("click", function () {
        var deletaText = $(this).prev().prev("span").text();
        $(this).parent().find(".pointpage_dv3").stop().show().children().children().children("span").text(deletaText);
    });
    //管理 删除按钮 取消
    $(".my_childAccount_deletebtn2").on("click", function () {
        $(this).parent().parent().parent().stop().hide();
    });
    //管理 删除按钮 确认
    /*$(".my_childAccount_deletebtn1").on("click", function(){
     $(this).parent().parent().parent().stop().hide();
     $(this).parent().parent().parent().parent().remove();
     });*/


    //授权
    //授权隐藏、显示
    $(".my_childAccount_pageul1 .my_childAccount_pointpage").hide();
    $(".my_childAccount_impower").on("click", function () {
        if ($(this).parent().parent().find("div.my_childAccount_pointpage").is(":hidden")) {

            getrolemodules($(this).parent().attr("usergroupid"));

            $(this).parent().parent().find("div.my_childAccount_pointpage").stop().show().siblings("div").hide();
            $(this).css("background", "#EEE").siblings().css("background", "#FFF");
        } else {
            $(this).parent().parent().find("div.my_childAccount_pointpage").stop().hide();
            $(this).css("background", "#FFF");
        }
    });


    //授权  取消
    $(".my_childAccount_addchildbtn2").on("click", function () {
        $(this).parent().parent().stop().hide();
        $(this).parent().parent().parent().find(".my_childAccount_impower").css("background", "#FFF");
        $(this).parent().parent().parent().find(".my_placemanage_impower").css("background", "#FFF");
    });
    /*//授权  确认
    $(".my_placemanage_addchildbtn1").on("click", function () {
        $(this).parent().parent().stop().hide();
        $(this).parent().parent().parent().find(".my_childAccount_impower").css("background", "#FFF");
        $(this).parent().parent().parent().find(".my_placemanage_impower").css("background", "#FFF");
        $(this).parent().parent().parent().find(".pointpage_dv4").stop().show();
    });
*/
    //my_childAccount_addchild.html页面   添加角色确认按钮
    //my_placemanage_addchild.html页面   添加账户确认按钮
    $(".my_childAccount_addchildbtn3, .my_placemanage_addchildbtn3").on("click", function () {
        var my_childAccount_addchildVal = $(".my_childAccount_pointpagep1 input").val();
        if (regName.test(my_childAccount_addchildVal)) {
            $(this).parent().parent().find(".pointpage_dv4").stop().show();
        }
    });


    /*	//授权
     //授权隐藏、显示
     $(".my_childAccount_pageul1 .my_childAccount_pointpage, .my_placemanage_pageul1 .my_childAccount_pointpage").hide();
     $(".my_childAccount_impower, .my_placemanage_impower").on("click", function(){
     if($(this).parent().parent().find("div.my_childAccount_pointpage").is(":hidden")){

     getuserplaces($(this).attr("GC_USERPLACE_userid"));

     $(this).parent().parent().find("div.my_childAccount_pointpage").stop().show().siblings("div").hide();
     $(this).css("background","#EEE").siblings().css("background","#FFF");
     }else{
     $(this).parent().parent().find("div.my_childAccount_pointpage").stop().hide();
     $(this).css("background","#FFF");
     }
     });*/


    /*function addimpower(){
     //授权  添加    全部添加
     $(".my_childAccount_pointpagedv_rightul p a").unbind("click");
     $(".my_childAccount_pointpagedv_rightul a").each(function(){})
     $(".my_childAccount_pointpagedv_rightul p a").on("click", function(){
     var addhtml=$(this).parent().parent().html();
     var addtitle=$(this).prev("span").text();
     var addtext=$(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").text();
     //判断左边删除项  是否已经存在该项
     if(addtext.indexOf(addtitle)!=-1){
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").find(":contains("+addtitle+")").parent().next("ul").append($(this).parent().next().html());
     $(".my_childAccount_pointpagedv_leftul ul a").text("删除");
     $(this).parent().parent().remove();
     /!*alert(111);*!/
     }else{
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").append("<li>"+addhtml+"</li>");
     $(this).parent().parent().remove();
     $(".my_childAccount_pointpagedv_leftul p a").text("全部删除");
     $(".my_childAccount_pointpagedv_leftul ul a").text("删除");
     $(".my_childAccount_pointpagedv_leftul ul").removeClass("my_childAccount_pointpagedv_rightul_ul").addClass("my_childAccount_pointpagedv_leftul_ul");
     /!*alert(222);*!/
     }
     addhtml=null;
     addtitle=null;
     addtext=null;
     addimpower();
     deleteimpower();
     })

     //授权  添加    子项添加
     $(".my_childAccount_pointpagedv_rightul_ul li a").unbind("click");
     $(".my_childAccount_pointpagedv_rightul_ul li a").on("click", function(){
     var addtitle=$(this).parent().parent().prev("p").children("span").text();
     var addtext=$(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").text();
     var addhtml=$(this).parent().html();
     //判断左边删除项  是否已经存在该项
     if(addtext.indexOf(addtitle)!=-1){
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").find(":contains("+addtitle+")").parent().next("ul").append("<li>"+addhtml+"</li>");
     $(".my_childAccount_pointpagedv_leftul ul a").text("删除");
     /!*alert(333);*!/
     //右边最后一个时，删除该项
     if($(this).parent().parent().children("li").length==1){
     $(this).parent().parent().parent().remove();
     }
     $(this).parent().remove();
     }else{
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_leftul").append("<li><p class='my_childAccount_pointpagedv_p'>"+$(this).parent().parent().prev("p").html()+"</p><ul class='my_childAccount_pointpagedv_leftul_ul'><li>"+addhtml+"</li></ul></li>");
     $(".my_childAccount_pointpagedv_leftul p a").text("全部删除");
     $(".my_childAccount_pointpagedv_leftul ul a").text("删除");
     $(".my_childAccount_pointpagedv_leftul ul").removeClass("my_childAccount_pointpagedv_rightul_ul").addClass("my_childAccount_pointpagedv_leftul_ul");
     /!*alert(444);*!/
     //右边最后一个时，删除该项
     if($(this).parent().parent().children("li").length==1){
     $(this).parent().parent().parent().remove();
     }
     $(this).parent().remove();
     }
     addhtml=null;
     addtitle=null;
     addtext=null;
     addimpower();
     deleteimpower();
     });
     };


     function deleteimpower(){
     //授权  删除    全部删除
     $(".my_childAccount_pointpagedv_leftul p a").unbind("click");
     $(".my_childAccount_pointpagedv_leftul p a").on("click", function(){

     var deletehtml=$(this).parent().parent().html();
     var deletetitle=$(this).prev("span").text();
     var deletetext=$(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").text();
     //判断右边添加项  是否已经存在该项
     if(deletetext.indexOf(deletetitle)!=-1){
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").find(":contains("+deletetitle+")").parent().next("ul").append($(this).parent().next().html());
     $(".my_childAccount_pointpagedv_rightul ul a").text("添加");
     $(this).parent().parent().remove();
     /!*alert(555);*!/
     }else{
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").append("<li>"+deletehtml+"</li>");
     /!*alert(666);*!/
     $(this).parent().parent().remove();
     $(".my_childAccount_pointpagedv_rightul p a").text("全部添加");
     $(".my_childAccount_pointpagedv_rightul ul a").text("添加");
     $(".my_childAccount_pointpagedv_rightul ul").removeClass("my_childAccount_pointpagedv_leftul_ul").addClass("my_childAccount_pointpagedv_rightul_ul");
     }
     deletehtml=null;
     deletetitle=null;
     deletetext=null;
     addimpower();
     deleteimpower();
     })

     //授权  删除    子项删除
     $(".my_childAccount_pointpagedv_leftul_ul li a").unbind("click");
     $(".my_childAccount_pointpagedv_leftul_ul li a").on("click", function(){

     var deletetitle=$(this).parent().parent().prev("p").children("span").text();
     var deletetext=$(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").text();
     var deletehtml=$(this).parent().html();
     //判断右边添加项  是否已经存在该项
     if(deletetext.indexOf(deletetitle)!=-1){
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").find(":contains("+deletetitle+")").parent().next("ul").append("<li>"+deletehtml+"</li>");
     $(".my_childAccount_pointpagedv_rightul ul a").text("添加");
     /!*alert(777);*!/
     //左边最后一个时，删除该项
     if($(this).parent().parent().children("li").length==1){
     $(this).parent().parent().parent().remove();
     }
     $(this).parent().remove();
     }else{
     $(this).parents(".my_childAccount_pointpagedv").find(".my_childAccount_pointpagedv_rightul").append("<li><p class='my_childAccount_pointpagedv_p'>"+$(this).parent().parent().prev("p").html()+"</p><ul class='my_childAccount_pointpagedv_rightul_ul'><li>"+deletehtml+"</li></ul></li>");
     $(".my_childAccount_pointpagedv_rightul p a").text("全部添加");
     $(".my_childAccount_pointpagedv_rightul ul a").text("添加");
     $(".my_childAccount_pointpagedv_rightul ul").removeClass("my_childAccount_pointpagedv_leftul_ul").addClass("my_childAccount_pointpagedv_rightul_ul");
     /!*alert(888);*!/
     //左边最后一个时，删除该项
     if($(this).parent().parent().children("li").length==1){
     $(this).parent().parent().parent().remove();
     }
     $(this).parent().remove();
     }
     deletehtml=null;
     deletetitle=null;
     deletetext=null;
     addimpower();
     deleteimpower();
     });

     };
     addimpower();
     deleteimpower();*/


    //授权  取消
    $(".my_childAccount_addchildbtn2").on("click", function () {
        $(this).parent().parent().stop().hide();
        $(this).parent().parent().parent().find(".my_childAccount_impower").css("background", "#FFF");
    });

    //场地授权  取消
/*    $(".my_placemanage_addchildbtn2").on("click", function () {
        $(this).parent().parent().stop().hide();
        $(this).closest("li").find(".my_placemanage_impower").css("background", "#FFF");
    });*/
    //授权  确认


    //my_childAccount_addchild.html页面   添加角色确认按钮
    //my_childAccount_addchild.html页面   添加账户确认按钮
    $(".my_childAccount_addchildbtn3, .my_placemanage_addchildbtn3").on("click", function () {
        var my_childAccount_addchildVal = $(".my_childAccount_pointpagep1 input").val();
        if (regName.test(my_childAccount_addchildVal)) {
            $(this).parent().parent().find(".pointpage_dv4").stop().show();
        }
    });


    //添加子账户
    //添加子账户隐藏、显示
    $(".my_childAccount_addchildrendv").hide();
    $(".my_childAccount_addchild").on("click", function () {
        if ($(this).closest("div").find(".my_childAccount_addchildrendv").is(":hidden")) {
            $(this).closest("div").find(".my_childAccount_addchildrendv").stop().show().siblings("div").hide();
            $(this).css("background", "#EEE").siblings().css("background", "#FFF");
        } else {
            $(this).closest("div").find(".my_childAccount_addchildrendv").stop().hide();
            $(this).css("background", "#FFF");
        }
    });
    //添加子账户  取消
    $(".my_childAccount_addchildrendvbtn2").on("click", function () {
        $(this).parent().parent().stop().hide();
        $(this).parent().parent().parent().find(".my_childAccount_addchild").css("background", "#FFF");
    });
    //添加子账户  确认
    $(".my_childAccount_addchildrendvbtn1").on("click", function () {
        if (regName.test($(".my_childAccount_addchildrenname").val()) && reg_childpsd.test($(".my_childAccount_addchildrenpsd").val())) {
            $(this).parent().parent().stop().hide();
            $(this).parent().parent().parent().find(".my_childAccount_addchild").css("background", "#FFF");
            $(this).parent().parent().parent().find(".pointpage_dv2").stop().show();
        }
    });


//my_placemanage.html页面
    //管理 显示隐藏
    $(".my_placemanage_resetpsd").on("click", function () {
        if ($(this).parent().parent().find(".my_placemanage_managedv").is(":hidden")) {
            $(this).parent().parent().find(".my_placemanage_managedv").stop().show().siblings("div").hide();
            $(this).css("background", "#EEE").siblings().css("background", "#FFF");
        } else {
            $(this).parent().parent().find(".my_placemanage_managedv").stop().hide();
            $(this).css("background", "#FFF");
        }
    });
    //管理 恢复初始密码
    $(".my_placemanage_beginpsd").on("click", function () {
        $(this).parent().parent().find(".pointpage_dv1").stop().show();
        $(this).parent().parent().find(".my_placemanage_managedv").stop().hide();
        $(".my_placemanage_resetpsd").css("background", "#FFF");
        $(".pointpage_dv1").on("click", function () {
            $(".pointpage_dv1").stop().hide();
        });
    });

    /*
     //删除按钮
     var deletaText="";
     var GC_USERPLACE_userid="";
     $(".my_placemanage_delete").on("click", function(){
     alert(111);
     deletaText=$(this).parent().parent().find(".deleteName").text();
     GC_USERPLACE_userid=$(this).attr("GC_USERPLACE_userid");
     $(".my_placemanage_deletebtn1").attr("GC_USERPLACE_userid", GC_USERPLACE_userid);
     $(this).parents(".page").find(".pointpage_dv3").stop().show().find(".my_placemanage_childname").text(deletaText);
     });
     //删除 取消
     $(".my_placemanage_deletebtn2").on("click", function(){
     $(this).parents(".pointpage_dv3").stop().hide();
     });
     //删除 确认
     $(".my_placemanage_deletebtn1").on("click", function(){
     $(this).parents(".pointpage_dv3").stop().hide();

     $(this).parents(".page").find(".deleteName").find(":contains("+deletaText+")").parent().remove();
     });
     */


//my_bindBankcard.html页面
    //更换
    $(".my_bindBankcard_changedv, .my_bindBankcard_changecard").hide();
    $(".my_bindBankcard_changebtn").on("click", function () {
        if ($(this).text() == "更换") {
            $(this).next().stop().show();
            $(this).text("取消");
        } else {
            $(this).next().stop().hide();
            $(this).text("更换");
        }
    });
    //确认   更换银行卡
    $(".my_bindBankcard_changedvbtn").on("click", function () {
        var my_bindBankcard_val = $(this).prev("input").val();
        if (my_bindBankcard_val == "123456") {
            $(".my_bindBankcard_changecard").stop().show();
            $(this).parent().parent().stop().hide();
            $(this).parent().stop().hide();
            $(this).parent().prev("a").text("更换");
        }
    });

    //银行卡输入值
    var my_bindBankcard = "";
    $(".my_bindBankcard_changecard input").on("keyup keydown", function (event) {
        if (event.which == 8) {
            my_bindBankcard = $(this).val();
            $(this).val(my_bindBankcard);

        } else if ((event.which >= 48 && event.which <= 57) || (event.which >= 96 && event.which <= 105) || event.which == 8) {
            if (my_bindBankcard.length < 25) {
                my_bindBankcard = $(this).val();
                $(this).val(my_bindBankcard);
                if (my_bindBankcard.length <= 20 && my_bindBankcard.length % 5 == 4) {
                    my_bindBankcard += " ";
                    $(this).val(my_bindBankcard);
                }
            } else {
                $(this).val(my_bindBankcard);
            }
        } else {
            $(this).val(my_bindBankcard);
        }
    });

    //确认银行卡号1
    $(".my_bindBankcard_changecardbtn1").on("click", function () {
        var my_bindBankcard1 = $(this).parent().prev("input").val();
        if (regbank.test(my_bindBankcard1)) {
            $(this).parent().parent().next().children().next("input").focus();
        }
    });

    //确认银行卡号2
    $(".my_bindBankcard_changecardbtn3").on("click", function () {
        var my_bindBankcard2 = $(this).parent().prev("input").val();
        var my_bindBankcard3 = $(".my_bindBankcard_changecardbtn1").parent().prev("input").val();
        if (regbank.test(my_bindBankcard2) && my_bindBankcard2 == my_bindBankcard3) {
            var lastfour = my_bindBankcard2.substring((my_bindBankcard2.length - 4), my_bindBankcard2.length);
            $(".my_bindBankcard_dvdv1 span:eq(1)").text("**** **** **** " + lastfour);
            $(".my_bindBankcard_dvdv1").stop().show();
            $(".my_bindBankcard_changedv, .my_bindBankcard_changecard").hide();
        }
    });


    //取消更换
    $(".my_bindBankcard_changecardbtn2, .my_bindBankcard_changecardbtn4").on("click", function () {
        $(".my_bindBankcard_dvdv1").stop().show();
        $(".my_bindBankcard_changecard").stop().hide();

    });


//my_childAccount_resetpsd.html页面
    $(".my_childAccount_resetpsd_dv a").on("click", function () {
        var my_childAccount_resetpsdvalue = $(".my_childAccount_resetpsd_dv input").val();
        if (reg_childpsd.test(my_childAccount_resetpsdvalue)) {
            $(".pointpage_dv1").stop().show();
        }
    });
    $(".pointpage_dv1, .pointpage_dv2, .pointpage_dv4").on("click", function () {
        $(this).stop().hide();
    });

//my_accountSafe_settel.html页面
    //验证码倒计时

    var my_accountSafe_timer = null;
    var my_accountSafe_second = 0;
    $(".my_accountSafe_textpoint, .my_accountSafe_losepoint").hide();
    $(".my_accountSafe_telcode").click(function () {
        if (!$(this).hasClass("cur")) {
            $(this).addClass("cur").text("重新发送（60s）");
            clearInterval(my_accountSafe_timer);
            my_accountSafe_timer = setInterval(function () {
                my_accountSafe_second++;
                if (my_accountSafe_second > 59) {
                    clearInterval(my_accountSafe_timer);
                    my_accountSafe_second = 0;
                    $(".my_accountSafe_telcode").removeClass("cur").text("获取验证码");
                } else {
                    $(".my_accountSafe_telcode").text("重新发送（" + (60 - my_accountSafe_second) + "s）");
                    $(".my_accountSafe_textpoint").stop().show();
                }
            }, 1000);
            getMobileCode();
        }
    });

    //验证码输入框
    var my_accountSafe_telcodeval = "";
    $(".my_accountSafe_codeinput").on("keyup keydown focus", function () {
        my_accountSafe_telcodeval = $(this).val();
        //my_accountSafe_telcodeval=$(".my_accountSafe_codeinput").val();
        if (reg_childcode.test(my_accountSafe_telcodeval)) {
            $(this).parent().find(".my_accountSafe_settel_nextbtn").addClass("cur");
        } else {
            $(this).parent().find(".my_accountSafe_settel_nextbtn").removeClass("cur");
        }
    });
    //更换手机 验证码 下一步
    /*$(".my_accountSafe_settel_nextbtn").on("click", function(){
     my_accountSafe_telcodeval=$(this).parent().prev().prev().prev().prev().val();
     //my_accountSafe_telcodeval=$(".my_accountSafe_codeinput").val();
     if($(this).hasClass("cur") && my_accountSafe_telcodeval=="123456"){
     window.location.href="my_accountSafe_settel_next.html";
     }else{
     $(".my_accountSafe_losepoint").stop().show().text("您输入的验证码有误！");
     }
     });*/
    //更换手机号码
    var my_accountSafe_newtel = "";
    $(".my_accountSafe_settel_next_losepoint").hide();
    $(".my_accountSafe_settel_next_newtel").on("keyup keydown focus", function () {
        my_accountSafe_newtel = $(this).val();
        if (my_accountSafe_newtel != "") {
            $(".my_accountSafe_settel_confirmbtn").addClass("cur");
        } else {
            $(".my_accountSafe_settel_confirmbtn").removeClass("cur");
        }
    });
    //更换手机号码 确认
    /*	$(".my_accountSafe_settel_confirmbtn").on("click", function(){
     my_accountSafe_newtel=$(".my_accountSafe_settel_next_newtel").val();
     if(reg_childtel.test(my_accountSafe_newtel)){
     $(".pointpage_dv1").show();
     }else{
     $(".my_accountSafe_settel_next_losepoint").stop().show().text("您输入的手机号码有误！");

     }
     });*/

//my_accountSafe_setloginpsd.html页面
    //修改登录密码 验证码 下一步
    $(".my_accountSafe_setloginpsd_nextbtn").on("click", function () {
        my_accountSafe_telcodeval = $(this).parent().prev().prev().prev().val();
        if ($(this).hasClass("cur") && my_accountSafe_telcodeval == "123456") {
            window.location.href = "my_accountSafe_setloginpsd_next.html";
        }
    });
    //密码输入
    $(".my_accountSafe_setloginpsd_next_losepoint, .my_accountSafe_setcashpsd_next_losepoint").hide();
    $(".my_accountSafe_setloginpsd_dv input").next("span").hide();
    var my_accountSafe_oldpsd = "";
    var my_accountSafe_newpsd = "";
    var my_accountSafe_confirmpsd = "";
    $(".my_accountSafe_setloginpsd_dv input").on("keyup keydown focus", function () {
        my_accountSafe_oldpsd = $(".my_accountSafe_setloginpsd_dv input:eq(0)").val();
        my_accountSafe_newpsd = $(".my_accountSafe_setloginpsd_dv input:eq(1)").val();
        my_accountSafe_confirmpsd = $(".my_accountSafe_setloginpsd_dv input:eq(2)").val();
        $(".my_accountSafe_setloginpsd_dv input").next("span").hide();
        if (my_accountSafe_oldpsd != "" && my_accountSafe_newpsd != "" && my_accountSafe_confirmpsd != "") {
            $(".my_accountSafe_confirmdv").children("a").addClass("cur");
        } else {
            $(".my_accountSafe_confirmdv").children("a").removeClass("cur");
        }
    });
    //确认
    $(".my_accountSafe_setloginpsd_confirmbtn, .my_accountSafe_setcashpsd_confirmbtn").on("click", function () {
        my_accountSafe_oldpsd = $(".my_accountSafe_setloginpsd_dv input:eq(0)").val();
        my_accountSafe_newpsd = $(".my_accountSafe_setloginpsd_dv input:eq(1)").val();
        my_accountSafe_confirmpsd = $(".my_accountSafe_setloginpsd_dv input:eq(2)").val();

        if (my_accountSafe_oldpsd == "") {
            $(".my_accountSafe_setloginpsd_dv p:eq(0)").children().next().next("span").stop().show().text("* 原密码不能为空");

        } else if (!reg_childpsd.test(my_accountSafe_oldpsd)) {
            $(".my_accountSafe_setloginpsd_dv p:eq(0)").children().next().next("span").stop().show().text("* 密码有误");

        } else if (my_accountSafe_newpsd == "") {
            $(".my_accountSafe_setloginpsd_dv p:eq(1)").children().next().next("span").stop().show().text("* 新密码不能为空");

        } else if (!reg_childpsd.test(my_accountSafe_newpsd)) {
            $(".my_accountSafe_setloginpsd_dv p:eq(1)").children().next().next("span").stop().show().text("* 请输入6位数字密码");

        } else if (my_accountSafe_confirmpsd == "") {
            $(".my_accountSafe_setloginpsd_dv p:eq(2)").children().next().next("span").stop().show().text("* 确认密码不能为空");

        } else if (!reg_childpsd.test(my_accountSafe_confirmpsd)) {
            $(".my_accountSafe_setloginpsd_dv p:eq(2)").children().next().next("span").stop().show().text("* 您输入的密码格式不正确");

        } else if (reg_childpsd.test(my_accountSafe_confirmpsd) && my_accountSafe_newpsd != my_accountSafe_confirmpsd) {
            $(".my_accountSafe_setloginpsd_dv p:eq(2)").children().next().next("span").stop().show().text("* 您两次输入的密码不一致");

        } else if (reg_childpsd.test(my_accountSafe_oldpsd) && reg_childpsd.test(my_accountSafe_newpsd) && reg_childpsd.test(my_accountSafe_confirmpsd) && my_accountSafe_newpsd == my_accountSafe_confirmpsd) {
            //$(".pointpage_dv1").stop().show();
            changPassword();
        }
    });


//my_accountSafe_setcashpsd.html页面
    //修改提现密码 验证码 下一步
    $(".my_accountSafe_setcashpsd_nextbtn").on("click", function () {
        my_accountSafe_telcodeval = $(this).parent().prev().prev().prev().val();
        if ($(this).hasClass("cur") && my_accountSafe_telcodeval == "123456") {
            window.location.href = "my_accountSafe_setcashpsd_next.html";
        }
    });


//my_cash_ing.html页面
    //余额输入框
    var my_cash_ingval = "";
    $(".my_cash_ingval").on("keyup keydown", function (event) {
        if ((event.which >= 48 && event.which <= 57) || (event.which >= 96 && event.which <= 105) || event.which == 110 || event.which == 190 || event.which == 8) {
            if (my_cash_ingval.indexOf(".") != -1) {
                if (my_cash_ingval.indexOf(".") == 0) {
                    my_cash_ingval = "0.";
                    $(this).val(my_cash_ingval);
                } else {
                    if ((event.which >= 48 && event.which <= 57) || (event.which >= 96 && event.which <= 105) || event.which == 8) {
                        my_cash_ingval = $(this).val();
                        $(this).val(my_cash_ingval);
                    } else {
                        $(this).val(my_cash_ingval);
                    }
                }
            } else {
                my_cash_ingval = $(this).val();
                $(this).val(my_cash_ingval);
            }
        } else {
            $(this).val(my_cash_ingval);
        }
    });
    //手续费，实际到账
    $(".my_cash_ingval").on("blur", function (event) {
        var my_cash_ingpsd = parseFloat($(this).val()).toFixed(2);
        var my_cash_ing_poundage = parseFloat(0.006 * my_cash_ingpsd).toFixed(2);
        $(".my_cash_ing_poundage").text("￥" + my_cash_ing_poundage);
        $(".my_cash_ing_reality").text("￥" + (my_cash_ingpsd - my_cash_ing_poundage));
    });

    //密码输入
    $(".my_cash_ing_cashpsd").on("keyup focus", function () {
        var my_cash_ingpsd = $(this).val();
        if ($(".my_cash_ingval").val() >= 0.01 && $(this).val() != "") {
            $(".my_cash_ingbtn").addClass("cur");
        } else {
            $(".my_cash_ingbtn").removeClass("cur");
        }
    });

    //提现成功
    $(".my_cash_ingbtn").on("click", function () {
        my_cash_ingval = parseFloat(my_cash_ingval).toFixed(2);
        $(".my_cash_ingval").val(my_cash_ingval);
        var my_cash_ingpsd = $(this).parent().prev().children().next("input").val();
        if ($(this).hasClass("cur") && my_cash_ingpsd == "123456") {
            $(".pointpage_dv1").stop().show();
        }
    });


});

;window.onload = function () {
    $(".loading").hide();
};
